package com.example.demo.controller;

import com.example.demo.dto.QuestionDTO;
import com.example.demo.dto.QuestionQueryDTO;
import com.example.demo.mapper.QuestionMapper;
import com.example.demo.server.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class QuestionController {

    @Autowired
    private QuestionService questionService;

//  传递 到页面上去
    @GetMapping("/question/{id}")
    public String question(@PathVariable(name = "id") Integer id
    ,Model model
    ) {
        id=1;
        QuestionDTO questionDTO=questionService.getbyId(id);
        model.addAttribute("question", questionDTO);
        return "question";
    }

}
